<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
   <style>
        .box{
        width:400px;
        border: 1px solid blue;
        margin: 100px auto;
    }
    .box input{
        width: 370px;
        height: 30px;
        outline: none;
        border: 0;
        margin: auto;
    }
   </style>
</head>
<body>
    <!-- <button>easd</button>
    <input type="password" placeholder="nini"/>g
    <script>
        var btn = document.querySelector('button');
        var input = document.querySelector('input');
        btn.onclick = function(){
            input.placeholder = 'safuihsdav';
            this.disabled = true;
        }
    </script> -->
    <div class="box">
        <label for="">x</label>
        <input type="password" name="" id="ipt"/>
    </div>

    <script>
        let lb = document.querySelector('label');
        let ipt = document.querySelector('#ipt');
        let flag= 0;
        lb.onclick = function(){
            if(flag == 0){
                ipt.type = 'text';
                 flag = 1
            }else{
                ipt.type = 'password';
                  flag = 0
            }
        }
    </script>

</body>
</html>